|
|
|
|
|
|
|
As you can see, this setup screen differs from the SQL Server driver dialog, because Microsoft Access needs different information than SQL Server. You need to fill in a unique data source name, such as EmployeeAccess. Next, you need to select the database you want to connect to (for example, D:\Employees\Employees.mdb). If youve created security groups for that particular MDB file, youll need to click the Database option button under the System Database frame and then click the Database button to choose the particular SYSTEM.MDW file for this MDB. When youre finished, click the OK button to save the DSN. |
|
|
|
|
|
|
|
|
You now have a DSN created that can be used to connect to the Jet database. Youll use this DSN from ADO to manipulate the data within the Access MDB file. |
|
|
|
|
|
|
|
|
Now that you have some background about connecting to a database, lets dive in and use the ADO data control. The data control allows you to connect information in a table to the text boxes, check boxes, and other controls on your form. By connecting a data control to the different controls on your form, youre able to view and edit data without writing a line of code. Figure 12.8 shows you what the data control looks like in the toolbox. |
|
|
|
|
|
|
|
|
To use the ADO data control, select Project, Components from the Visual Basic menu. Select Microsoft ADO Data Control 6.0 (OLEDB) from the list of available components. Once you add this component to your project, a new tool is added to the toolbox (see Figure 12.8). |
|
|
|
|
|
|
|
|
Figure 12.8
The ADO data control in the toolbox. |
|
|
|
|
|